//引入接口
import { postList } from "@/utils/api";
import { getsearch } from "@/utils/api";
import { postRegistry } from "@/utils/api";
import { postLogin } from "@/utils/api";
const actions = {
  async getUser({ commit }, playload) {
    console.log(playload);
    const res = await postRegistry({
      uname: playload.uname,
      upwd: playload.upwd,
    });
    commit("postUser", { registryName: res });
  },

  async getLogin({ commit }, playload) {
    // console.log(playload)
    const res = await postLogin({
      info: playload.info,
    });
    commit("postLoginUser", { loginName: res });
  },

  async getList({ commit }, playload) {
    const res = await postList({
      tid: playload || 1,
    });
    commit("postListId", { list: res.result });
  },

  async getSearchactions({ commit }, playload) {
    const res = await getsearch({
      cname: playload.name,
    });
    commit("getSearch", { searchName: res.result }); //|| res
  },
};
export default actions;
